home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Developer CD v1.1
/
Amiga Developer CD v1.1 - May 1996 (1996)(Schatztruhe)[!].iso
/
Reference
/
Amiga_Mail_Vol2
/
I-7
/
FilePat.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-01-30
|
6KB
|
150 lines
;/* filepat.c - Execute me to compile me with SAS/C 6.56
sc DATA=NEAR NMINC STRMERGE STREQ NOSTKCHK SAVEDS IGNORE=73 filepat.c
slink FROM LIB:c.o,filepat.o TO filepat LIBRARY LIB:sc.lib,LIB:amiga.lib
quit
*/
/*
Copyright (c) 1991 Commodore-Amiga, Inc.
This example is provided in electronic form by Commodore-Amiga,
Inc. for use with the Amiga Mail Volume II technical publication.
Amiga Mail Volume II contains additional information on the correct
usage of the techniques and operating system functions presented in
these examples. The source and executable code of these examples may
only be distributed in free electronic form, via bulletin board or
as part of a fully non-commercial and freely redistributable
diskette. Both the source and executable code (including comments)
must be included, without modification, in any copy. This example
may not be published in printed form or distributed with any
commercial product. However, the programming techniques and support
routines set forth in these examples may be used in the development
of original executable software products for Commodore Amiga
computers.
All other rights reserved.
This example is provided "as-is" and is subject to change; no
warranties are made. All use is at your own risk. No liability or
responsibility is assumed.
*/
#include <clib/asl_protos.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/alib_stdio_protos.h>
#include <workbench/startup.h>
#include <intuition/intuition.h>
#include <intuition/screens.h>
#include <graphics/displayinfo.h>
#include <exec/libraries.h>
#ifdef LATTICE
int CXBRK(void) { return(0); } /* Disable Lattice CTRL/C handling */
int chkabort(void) { return(0); } /* really */
#endif
UBYTE *vers = "\0$VER: filepat 1.0";
void main(void);
struct Library *AslBase;
struct IntuitionBase *IntuitionBase;
struct Screen *screen;
struct Window *window;
struct WBArg *wbargs;
LONG x;
void main()
{
struct FileRequester *fr;
if (AslBase = OpenLibrary("asl.library", 36L))
{
if (IntuitionBase = (struct IntuitionBase *)
OpenLibrary("intuition.library", 36L))
{
if (screen = (struct Screen *)OpenScreenTags(NULL,
SA_DisplayID, HIRESLACE_KEY,
SA_Title, "ASL Test Screen",
TAG_END))
{
if (window = (struct Window *)OpenWindowTags(NULL,
WA_CustomScreen, screen,
WA_Title, "ASL Test Window",
WA_Flags, WINDOWDEPTH | WINDOWDRAG,
TAG_END))
{
if (fr = (struct FileRequester *)
AllocAslRequestTags(ASL_FileRequest,
ASL_Hail, (ULONG)"RKM File Requester, FilePat",
ASL_Dir, (ULONG)"libs:",
ASL_File, (ULONG)"asl.library",
/* The initial pattern string for the
** pattern gadget.
*/
ASL_Pattern, (ULONG)"~(rexx#?|math#?)",
/* turn on multiselection and the pattern
** matching gadget.
*/
ASL_FuncFlags, FILF_MULTISELECT | FILF_PATGAD,
/* This requester is associated with this
** window (and uses its message port).
*/
ASL_Window, window,
TAG_DONE))
{
/* Application code body...*/
/* Put up file requester */
if (AslRequest(fr, 0L))
{
/* If the file requester's rf_NumArgs field
** is not zero, the user multiselected. The
** number of files is stored in rf_NumArgs.
*/
if (fr->rf_NumArgs)
{
/* rf_ArgList is an array of WBArg structures
** (defined in <workbench/startup.h>).
** Each entry in the WBArg array corresponds
** to one of the files the user selected
** (the entries are in alphabetical order).
*/
wbargs = fr->rf_ArgList;
/* The user multiselected, step through
** the list of selected files.
*/
for ( x=0; x < fr->rf_NumArgs; x++ )
printf("Argument %d - %s%s\n", x,
fr->rf_Dir, wbargs[x].wa_Name);
}
else
/* The user didn't multiselect, use the
** normal way to get the file name.
*/
printf("%s%s\n", fr->rf_Dir, fr->rf_File);
}
/* More application code body... */
/* Done with the FileRequester, better return it */
FreeAslRequest(fr);
}
CloseWindow(window);
}
CloseScreen(screen);
}
CloseLibrary(IntuitionBase);
}
CloseLibrary(AslBase);
}
}